<template>
    <div class="det">
      <img @click="cx" class="img" :src="onfood.image" alt="">
      <section class="dethead">
        <h3>{{onfood.name}}</h3>
        <span class="p">月销量{{onfood.sellCount}}份</span>
        <span class="p">好评{{onfood.rating}}%</span>
        <div class="jg">￥{{onfood.price}}<del>￥{{onfood.oldPrice}}</del></div>
        <div class="addcar">加入购物车</div>
      </section>
      <div class="hangge"></div>
      <section class="intro">
        <h3 class="h3">商品介绍</h3>
        <p>{{onfood.info}}</p>
      </section>
      <div class="hangge"></div>
      <div class="eva">
        <h3 class="h3">商品评价</h3>
        <div class="evafen">
          <div>全部<span>57</span></div>
          <div>推荐<span>57</span></div>
          <div>吐槽<span>57</span></div>
        </div>
        <div class="onlylook">
          <svg style="width: 0.64rem;height: 0.64rem;">
            <image xlink:href="../../../static/img/check_circle.svg" style="width: 0.64rem;height: 0.64rem"></image>
          </svg>
          只看有内容的评价
        </div>
      </div>
      <section class="pjnr">
        <ul>
          <li v-for="(item,index) in onfood.ratings" :key="index">
            <div class="userxx"><span>{{item.username}}</span> <img :src="item.avatar" alt=""></div>
            <div class="time">2016-07-07  12:34</div>
            <div class="econ">
              <svg v-if="item.rateType == 1" style="width: 0.24rem;height: 0.24rem;">
              <image xlink:href="../../../static/img/thumb_down.svg" style="width: 0.24rem;height: 0.24rem"></image>
              </svg>
              <svg v-if="item.rateType == 0" style="width: 0.24rem;height: 0.24rem;">
                <image xlink:href="../../../static/img/thumb_up.svg" style="width: 0.24rem;height: 0.24rem"></image>
              </svg>
              <span>{{item.text}}</span>
            </div>
          </li>
        </ul>
      </section>
    </div>
</template>

<script>
export default {
  name: 'detail',
  data () {
    return {
      // sd: false
    }
  },
  props: ['onfood'],
  methods: {
    cx () {
      let obj = false
      this.$emit('gfa', obj)
    }
    // show () {
    //   this.sd = !this.sd
    // }
  }
}
</script>

<style scoped lang="less">
.h3{
  font-size: 0.28rem;
  color: rgb(7,17,27);
  line-height:0.28rem;
}
.det{
  overflow: auto;
  background: white;
  width: 100%;
  position: fixed;
  top: 0;
  bottom: 0;
  margin-bottom: 1rem;
  box-sizing: border-box;
  .img{
    width: 100%;
    height: 7.5rem;
  }
  .dethead{
    position: relative;
    padding: 0.36rem;
    box-sizing: border-box;
    h3{
      font-size: 0.28rem;
      font-weight: 700;
      color: rgb(7,17,27);
      line-height: 0.28rem;
    }
    .p{
      font-size: 0.2rem;
      color: rgb(147,153,159);
      line-height: 0.2rem;
    }
    .jg{
      margin-top: 0.72rem;
      font-size: 0.28rem;
      font-weight: 700;
      color: rgb(240,20,20);
      line-height: 0.48rem;
      del{
        font-size: 0.2rem;
        color: rgb(147,153,159);
      }
    }
    .addcar{
      position: absolute;
      bottom: 0.36rem;
      right: 0.36rem;
      width: 1.48rem;
      height: 0.48rem;
      border-radius: 0.24rem;
      background-color: rgb(0,160,220);
      font-size: 0.2rem;
      color: white;
      line-height: 0.48rem;
      text-align: center;
    }
  }
  .hangge{
    height: 0.32rem;
    background-color: #f3f5f7;
    border-top: solid rgba(7,17,27,0.1) 0.02rem;
    border-bottom: solid rgba(7,17,27,0.1) 0.02rem;
  }
  .intro{
    padding: 0.36rem;
    box-sizing: border-box;
    p{
      padding: 0.24rem;
      box-sizing: border-box;
      width: 100%;
      word-break: break-all;
      word-wrap: break-word;
      font-size: 0.24rem;
      font-weight: 200;
      color: rgb(77,85,93);
      line-height: 0.48rem;
    }
  }
  .eva{
    padding: 0.36rem;
    padding-bottom: 0;
    border-bottom: 0.02rem solid rgba(7, 17, 27, 0.4);
    box-sizing: border-box;
    .evafen{
      margin-top: 0.36rem;
      display: flex;
      border-bottom: 0.02rem solid darkgray;
      padding-bottom: 0.36rem;
      div{
        margin-right: 0.16rem;
        padding: 0.16rem 0.24rem;
        text-align: center;
        font-size: 0.24rem;
        background: aqua;
        line-height: 0.32rem;
        span{
          font-size: 0.08rem;
        }
      }
    }
    .onlylook {
      height: 1rem;
      padding: 0.20rem 0rem;
      box-sizing: border-box;
      font-size: 0.36rem;
      /*border-bottom: 0.01rem solid rgba(7, 17, 27, 0.4);*/
      svg {
        display: inline-block;
        vertical-align: middle;
      }
    }
  }
  .pjnr{
    padding: 0 0.36rem;
    box-sizing: border-box;
    ul{
      li{
        padding: 0.32rem 0;
        border-bottom: #7e8c8d solid 0.02rem;
        .userxx{
          float: right;
          font-size: 0.2rem;
          color: rgb(147,153,159);
          line-height: 0.24rem;
          img{
            margin-left: 0.12rem;
            width: 0.24rem;
            height: 0.24rem;
            border-radius: 50%;
            vertical-align: middle;
          }
        }
        .time{
          font-size: 0.2rem;
          color: rgb(147,153,159);
          line-height: 0.24rem;
        }
        .econ{
          display: flex;
          align-items: center;
          margin-top: 0.12rem;
          font-size: 0.24rem;
          color: rgb(7,17,27);
          line-height: 0.32rem;
          span{
            margin-left: 0.08rem;
          }
        }
      }
    }
  }
}

</style>
